<template>
    <view class="container">
        <header-bar :config="config"></header-bar>
        <view class="input-main-page">
            <view class="input-main-box">
                <input v-model="code" class="input-purchase-code" placeholder="请输入条形码" />
            </view>
            <button class="btn btn-main flex-fill btn-sure-code" @click="submitFn">确定</button>
        </view>
    </view>
</template>

<script>
import { GetBuyOrdStockOutByOutNo } from "@/service/api/buyOrder.js"
export default {
    components: {},
    data() {
        return {
            config: {
                title: "输入条形码",
                centerSlot: true,
            },
            id: 0,
            code: "",
        }
    },
    mounted() {},
    methods: {
        submitFn() {
            if (this.code.trim() == "") {
                this.easyToast("请输入条形码")
                return
            }
            let param = {
                keyWord: this.code,
            }
            let path = "?keyWord=" + this.code
            GetBuyOrdStockOutByOutNo(param, path).then((res) => {
                if (res.State == 1) {
                    let data = encodeURIComponent(JSON.stringify(res.Data))
                    this.easyGoTo("/pages_work/packet/purchase/confirm?keyWord=" + this.code + "&data=" + data)
                } else {
                    this.easyToast(res.Msg)
                }
            })
        },
    },
}
</script>

<style lang="scss" scoped>
.input-main-page {
    padding: $app-page-padding;
    margin-top: 200rpx;
}
.input-purchase-code {
    font-size: $font-size-40;
    display: flex;
    flex: 1;
    height: 88rpx;
    justify-content: center;
    align-items: center;
    border-bottom: solid 1rpx #666666;
    margin-bottom: 70rpx;
    text-align: center;
}
.btn-sure-code {
    height: 98rpx;
}
.disabled {
    border: none;
}
</style>
